﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ChurchDiary.TableEntity
{
    [Table("Ch_Newsletter")]
    public class EntityNewsletter
    {
        [Key]
        public Guid NewsLetterId { get; set; }
        public string NewsLetterSubject { get; set; }
        public string NewsLetterContent { get; set; }
        public bool IsDeleted { get; set; }
        /// <summary>
        /// 1  pending for approval
        /// -1 Rejected
        /// -2 Deleted
        /// 2  Approved
        /// 3  Approved Ready to send
        /// 4  Sent Mail
        /// </summary>
        public int NewsLetterStatus { get; set; }
        public Guid? CreatedBy { get; set; }
        public DateTime? CreatedOn { get; set; }
        public Guid? UpdatedBy { get; set; }
        public DateTime? UpdatedOn { get; set; }

        public List<EntityNewsletterStatus> NewsletterState {get; set; }
    }

    [Table("Ch_NewsletterStatus")]
    public class EntityNewsletterStatus
    {
        [Key]
        public Guid NewsLetterStatusId { get; set; }
        public Guid NewsLetterId { get; set; }
        /// <summary>
        /// 1 Send Successfully
        /// 2 Failed to send
        /// </summary>
        public int NewsLetterStatus { get; set; }
        public string ReciptantMailId { get; set; }
        public DateTime NewsLetterDeliveredOn { get; set; }

        public Guid? CreatedBy { get; set; }
        public DateTime? CreatedOn { get; set; }
        public Guid? UpdatedBy { get; set; }
        public DateTime? UpdatedOn { get; set; }
    }

    [Table("CH_Article")]
    public class EntityArticle
    {
        [Key]
        public Guid ArtitcleId { get; set; }
        public string ArticleName { get; set; }
        public string ArticleTitle { get; set; }
        public string ArticleImage { get; set; }
        public string ArticleContent { get; set; }
        public bool status { get; set; }
        public Guid? CreatedBy { get; set; }
        public DateTime? CreatedOn { get; set; }
        public Guid? UpdatedBy { get; set; }
        public DateTime? UpdatedOn { get; set; }
    }

    [Table("CH_Banner")]
    public class EntityBanner
    {
        [Key]
        public Guid BannerId { get; set; }
        public string BannerImage { get; set; }
        public bool Status { get; set; }
        public int OrderNo { get; set; }
        public Guid? CreatedBy { get; set; }
        public DateTime? CreatedOn { get; set; }
        public Guid? UpdatedBy { get; set; }
        public DateTime? UpdatedOn { get; set; }
    }

    [Table("CH_VideoCategory")]
    public class EntityVideoCategory
    {
        [Key]
        [Display(Name = "VideoCategory Id")]
        public Guid VideoCategoryId { get; set; }
        [Display(Name = "VideoCategory Name")]
        public string VideoCategoryName { get; set; }
        [Display(Name = "status")]
        public int status { get; set; }
    }

    [Table("CH_PhotoCategory")]
    public class EntityPhotoCategory
    {
        [Key]
        [Display(Name = "Photo Category Id")]
        public Guid PhotoCategoryId { get; set; }
        [Display(Name = "Photo Category Name")]
        public string PhotoCategoryName { get; set; }
        [Display(Name = "status")]
        public int status { get; set; } 
    }

    [Table("CH_NewsCategory")]
    public class EntityNewsCategory
    {
        [Key]
        public Guid NewsCategoryId { get; set; }
        public string NewsCategory { get; set; }
        public int status { get; set; }
    }

    [Table("CH_EventCategory")]
    public class EntityEventCategory
    {
        [Key]
        [Display(Name = "Event Category Id")]
        public Guid EventCategoryId { get; set; }
        [Display(Name = "Event Category Name")]
        public string EventCategoryName { get; set; }
        [Display(Name = "status")]
        public int status { get; set; }

        
    } 

    [Table("CH_Video")]
    public class EntityVideos
    {
        [Key]
        public Guid VideoId { get; set; }
        public Guid VideoCategoryId { get; set; }
        [MaxLength(100)]
        public string VideoTitle { get; set; }
        public string VideoUrl { get; set; }
        public string VideoDate { get; set; }
        public string VideoDesc { get; set; }
        public int status { get; set; }
        

        public EntityVideoCategory VideoCategory { get; set; }
        
    }

    [Table("CH_Photo")]
    public class EntityPhoto
    {
        [Key]
        public Guid PhotoId { get; set; }
        public Guid PhotoCategoryId { get; set; }
        [MaxLength(100)]
        public string PhotoUrl { get; set; }
        public int status { get; set; }
        public string PhotoName { get; set; }
        public Guid Updatedby { get; set; }
        public Guid Createdby { get; set; }
        public DateTime CreatedOn { get; set; }
        public DateTime UpdatedOn { get; set; }

        public EntityPhotoCategory PhotoCategory { get; set; }
        
    }

    [Table("CH_News")]
    public class EntityNews
    {
        [Key]
        public Guid NewsId { get; set; }
        public Guid NewsCategoryId { get; set; }
        public string NewsName { get; set; }
        public string NewsDate { get; set; }
        public string NewsActiveDate { get; set; }
        public string NewsExpairyDate { get; set; }
        public Guid? Createdby { get; set; }
        public DateTime? CreatedOn { get; set; }
        public Guid? Updatedby { get; set; }
        public DateTime? UpdatedOn { get; set; }
        public int Status { get; set; }
        public List<EntityNewsDetails> NewsDetails { get; set; }
        public EntityNewsCategory NewsCategory { get; set; }
        public EntityImages EntityImages { get; set; }

    }

    public class EntityNewsWeb
    {
        public EntityNews News { get; set; }
        public EntityNewsDetails NewsDetails { get; set; }
        public EntityImages Images { get; set; }
        public EntityNewsCategory NewsCategory { get; set; }
        public EntityLanguage Language { get; set; }
        public int noofComments { get; set; }
        public string Image { get; set; }

    }

    public class EntityFullNewsInfo
    {
        public EntityNews News { get; set; }
        public List<EntityLanguage> Language { get; set; }
        public List<EntityImages> Images { get; set; }
        public List<EntityComments> Comments { get; set; }
        public EntityNewsDetails NewsDetails { get; set; }
        public List<EntityNewsDetails> Detailslist { get; set; }

    }

    [Table("CH_Events")]
    public class EntityEvents
    {
        [Key]
        public Guid EventId { get; set; }
        public string EventHead { get; set; }
        public string EventContent { get; set; }
        public DateTime EventStartDate { get; set; }
        public DateTime EventEndDate { get; set; }
        public string EventStartTime { get; set; }
        public string EventEndTime { get; set; }
        public string EventPlace { get; set; }
        public DateTime ActiveDate { get; set; }
        public DateTime ExpairyDate { get; set; }
        public Guid Createdby { get; set; }
        public DateTime CreatedOn { get; set; }
        public string Image { get; set; }
        public int SharingType { get; set; }
        public Guid UserId { get; set; }
        public int StatusId { get; set; }
        public Guid EventCategoryId { get; set; }

        public EnitityStatus Status { get; set; }
        public EntityEventCategory EventCategory { get; set; }
        public List<EntityEventTable> EventTable { get; set; }
    }

    [Table("CH_EventTable")]
    public class EntityEventTable
    {
        [Key]
        public Guid EventTableId { get; set; }
        public Guid EventId { get; set; }
        [Display(Name="Event Date")]
        public DateTime EventDate { get; set; }
        [Display(Name = "Event Start Time")]
        public string EventStartTime { get; set; }
        [Display(Name = "Event End Time")]
        public string EventEndTime { get; set; }
        [Display(Name = "Place Or Address")]
        public string EventPlace { get; set; }
        [Display(Name = "IsLive Stream Avail")]
        public bool? IsLiveStream { get; set; }
        public Guid? Createdby { get; set; }
        public DateTime? CreatedOn { get; set; }
        public Guid? Updatedby { get; set; }
        public DateTime? UpdatedOn { get; set; }
    }

    [Table("CH_Magazine")]
    public class EntityMagazine
    {
        [Key]
        public Guid MagazineId { get; set; }
        [Required]
        public string MagazineHead { get; set; }
        [Required]
        public string MagazineStartImage { get; set; }
        [Required]
        public string MagazineFile { get; set; }
        [Required]
        public string MagazineMonth { get; set; }
        [Required]
        public string MagazineYear { get; set; }
        [Required]
        public int Status { get; set; }
    }

    [Table("CH_NewsDetails")]
    public class EntityNewsDetails 
    { 
        [Key] 
        public Guid NewsDetailsId { get; set; } 
        public Guid NewsId { get; set; } 
        public Guid LanguageId { get; set; } 
        public string NewsHead { get; set; } 
        public string NewsContent { get; set; } 
        public EntityLanguage Language { get; set; } 
        public EntityNews News { get; set; } 
    }

    [Table("CH_Images")]
    public class EntityImages { 
        [Key]
        public Guid ImageId { get; set; }
        public Guid ImageMapId { get; set; }
        public string ImageName { get; set; } 
        public int Status { get; set; } 
    }

    [Table("CH_Subcriber")]
    public class EntitySubcriber 
    { 
        [Key] 
        public Guid SubcriberId { get; set; }
        public string SubcriberName { get; set; } 
        public string SubcriberPhone { get; set; } 
        public string SubcriberEmail { get; set; }
        public string Status { get; set; } 
        public string SubcriberOn { get; set; } 
    }

    [Table("CH_Message")]
    public class EntityMessage
    {
        [Key]
        public Guid ContactId { get; set; }
        public string Name { get; set; }
        public string Email { get; set; }
        public string Phone { get; set; }
        public string Message { get; set; }
        public int Status { get; set; }
    }

    
    [Table("CH_Music_Albums")]
    public class EntityAlbums 
    {
        [Key]
        public Guid AlbumId { get; set; }
        public string AlbumName { get; set; }
        public string AlbumtitleImage { get; set; }
        public string AlbumBy { get; set; }

        public int Status { get; set; }
        public Guid? Createdby { get; set; }
        public DateTime? CreatedOn { get; set; }
        public Guid? Updatedby { get; set; }
        public DateTime? UpdatedOn { get; set; }

        [NotMapped]
        public int TotalCounts { get; set; }

        public List<EntitySongs> Songs { get; set; }
    }

    [Table("CH_Music_Songs")]
    public class EntitySongs
    {
           [Key]
        public Guid SongId { get; set; }
        public Guid AlbumId { get; set; }
        public string SongName { get; set; }
        public string SongBy { get; set; }
        public string SongFileName { get; set; }
        public string SongTitleImage { get; set; }

        public int Status { get; set; }
        public Guid? Createdby { get; set; }
        public DateTime? CreatedOn { get; set; }
        public Guid? Updatedby { get; set; }
        public DateTime? UpdatedOn { get; set; }

        public EntityAlbums Albums { get; set; }
    }

    [Table("CH_WebsiteVisiter")]
    public class EntityWebsiteVisiter
    {
        public EntityWebsiteVisiter()
        {
            VisitersId = Guid.NewGuid();
            VisitedTime = DateTime.UtcNow;
            try
            {
                SessionId = System.Web.HttpContext.Current.Session.SessionID;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
        public Guid VisitersId { get; set; }
        [Key]
        [MaxLength(500)]
        public string SessionId { get; set; }
        [MaxLength(100)]
        public string IpAddress { get; set; }
        public DateTime VisitedTime { get; set; }

    }
    [Table("CH_WebsiteVisiterBrowser")]
    public class EntitWebsiteVisiterBrowserDetails
    {
        [Key]
        public Guid VisiterBrowserDetailsId { get; set; }
        [MaxLength(500)]
        public string SessionId { get; set; }
        public EntitWebsiteVisiterBrowserDetails()
        {
            VisiterBrowserDetailsId = Guid.NewGuid();
            try
            {
                Browser = System.Web.HttpContext.Current.Request.Browser.Browser;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                IsBeta = System.Web.HttpContext.Current.Request.Browser.Beta;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                IsEnableBackgroundSounds = System.Web.HttpContext.Current.Request.Browser.BackgroundSounds;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                IsAmerianOnlineBrowser = System.Web.HttpContext.Current.Request.Browser.AOL;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                MinorVersion = System.Web.HttpContext.Current.Request.Browser.GatewayMinorVersion;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                Version = System.Web.HttpContext.Current.Request.Browser.GatewayVersion;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                BrowserId = System.Web.HttpContext.Current.Request.Browser.Id;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                IsColor = System.Web.HttpContext.Current.Request.Browser.IsColor;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                IsMobileDevice = System.Web.HttpContext.Current.Request.Browser.IsMobileDevice;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                MobileDeviceManufacturer = System.Web.HttpContext.Current.Request.Browser.MobileDeviceManufacturer;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                MobileDeviceModel = System.Web.HttpContext.Current.Request.Browser.MobileDeviceModel;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                Platform = System.Web.HttpContext.Current.Request.Browser.Platform;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                RequiredMetaTagNameValue = System.Web.HttpContext.Current.Request.Browser.RequiredMetaTagNameValue;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                ScreenPixelsHeight = System.Web.HttpContext.Current.Request.Browser.ScreenPixelsHeight;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                ScreenPixelsWidth = System.Web.HttpContext.Current.Request.Browser.ScreenPixelsWidth;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            try
            {
                BrowserVersion = System.Web.HttpContext.Current.Request.Browser.Version;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }

        public string Browser { get; set; }
        public string Version { get; set; }
        public string BrowserId { get; set; }
        public string MobileDeviceManufacturer { get; set; }
        public string MobileDeviceModel { get; set; }
        public string Platform { get; set; }
        public string RequiredMetaTagNameValue { get; set; }
        public string BrowserVersion { get; set; }

        public int ScreenPixelsHeight { get; set; }
        public int ScreenPixelsWidth { get; set; }

        public bool IsBeta { get; set; }
        public bool IsEnableBackgroundSounds { get; set; }
        public bool IsAmerianOnlineBrowser { get; set; }
        public bool IsColor { get; set; }
        public bool IsMobileDevice { get; set; }

        public double MinorVersion { get; set; }
    }
}




